﻿using FlowCanvas;
using FlowCanvas.Nodes;

namespace Yoozoo.Gameplay.Liberty.StreetEvent
{
    public class IsCounterDirty : FlowControlNode
    {
        public bool resetDirty = false;
        
        protected override void RegisterPorts()
        {
            var caseTrue = AddFlowOutput("True");
            var caseFalse = AddFlowOutput("False");
            AddFlowInput("In", (f) =>
            {
                bool isTrue = StreetTaskCountUtils.streetTaskCounterDirty;
                if (resetDirty)
                {
                    StreetTaskCountUtils.streetTaskCounterDirty = false;
                }
                if (isTrue)
                {
                    f.Call(caseTrue);
                }
                else
                {
                    f.Call(caseFalse);
                }
            });

        }
    }
}